package ch.fusun.baron.basic.command;

import ch.fusun.baron.basic.initialization.PlayerInitializer;
import ch.fusun.baron.coatofarms.ui.CoatOfArmsData;
import ch.fusun.baron.core.command.GameCommand;
import ch.fusun.baron.core.initialization.GameInitializationUtil;
import ch.fusun.baron.core.injection.Inject;
import ch.fusun.baron.core.rmi.User;

/**
 * Sets the coat of arms of a dynasty
 */
public class SetCoatOfArmsCommand extends GameCommand {

	@Inject
	private transient GameInitializationUtil util;

	private CoatOfArmsData data;

	private User user;

	/**
	 * Kryo
	 */
	public SetCoatOfArmsCommand() {
	}

	/**
	 * @param data
	 *            The data
	 * @param user
	 *            The user
	 */
	public SetCoatOfArmsCommand(CoatOfArmsData data, User user) {
		this.data = data;
		this.user = user;
	}

	@Override
	public boolean isAllowed() {
		return true;
	}

	@Override
	public void execute() {
		util.get(PlayerInitializer.class).setDynastyCoatOfArms(user, data);
	}

}
